<include file="Public:header"/>
<div class="cat" style="margin-top:10px;">
<form method="POST" action="__GROUP__/Goodsmodel/add">
	<input type="text" name="name" size="20" value="请输入模型的名称">
	<input type="submit" value="添加新模型" name="B1">
</form>
</div>

<div class="cat" style="margin-top:10px;">
<table bordercolor="#DDDFFF" border="1" width="100%" style="border-collapse: collapse" cellpadding="3">
	<tr height="17" align="center">
		<td class="title" width="300">模型名称</td>
		<td class="title" width="80">查看/修改字段</td>
		<td class="title" width="40">删除</td>
		<td class="title">　</td>
	</tr>
<volist name="model" id="model">
	<tr height="20" bgcolor="#F1F5FA" class="cat_list">
		<td width="300"><input name="mid[]" type="text" value="{$model.model_id}" style="display:none"><input type="text" name="mname[]" value="{$model.model_name}"></td>
		<td width="80" align="center"><a href="__URL__/model_list/model_id/{$model.model_id}"><img src="__APP__/statics/add44.gif"></a></td>
		<td width="40" align="center"><a href="javascript:;" onclick="del({$model.model_id})"><img alt="删除" src="__APP__/statics/icons/icon_delete.gif"></a></td>

		<td></td>
	</tr>
</volist>
</table>
</div>
<div id="save"><input id="save_m" type="button" value="保存更改"></div>

<script>
$(function(){
    $("#save_m").click(function(){
              var mid=[];
			  $("[name='mid[]']").each(function(){
                     mid.push($(this).val()); 
               }); 
			   var mname=[];
			  $("[name='mname[]']").each(function(){
                     mname.push($(this).val()); 
               }); 
			   $.ajax({
			         type:"POST",
					 url:"__URL__/cg_model",
					 dataType:"html",
					 data:{'mid':mid,'mname':mname},
					 success:function(data){
						location.reload();
					 }
			   })
	})
})

function del(t){
	if(confirm('你确认删除此模型吗？')) {
		$.get("__URL__/del_model",{'id':t},function(res){
		location.reload();
		})
	}
}
</script>

